<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
<title>title</title>
<script type="text/javascript" src="http://code.jquery.com/jquery-1.11.1.js"></script>
<script type="text/javascript">
	$(document).ready(function(){
		$('#searchBtn').click(function(){
			var searchCommand=$('select option:selected').val();
			var searchValue=$('#search').val();
			
			location.href='/OffTheRecord/getBoardBySearch.action?searchCommand='+searchCommand+'&searchValue='+searchValue;
		});
	});
</script>
</head>
<body>
<c:import url="../common/top.jsp"></c:import>
<div class="container" style="margin: 30px;"></div>

<div class="container">
<div class="row">

<div class=" col-xs-12 col-sm-12 col-md-12 col-lg-12">
	<div class="jumbotron" style="height: 50px;">
		<font style="font-weight: bold; font-size: 20px;">자유게시판</font><p><p>
	</div>
</div>

<div class="col-sm-2 col-md-2- col-lg-2"></div>

<!--  -->
<div class="col-xs-12 col-sm-8 col-md-8- col-lg-8">
<div class="bs-example">
      <div class="table-responsive">
        <table class="table table-hover">
          <thead>
            <tr>
              <th>#</th>
              <th style="width: 100px;">User</th>
              <th></th>
              <th style="width: 500px;">Title</th>
              <th>DateOfPreparation</th>
              <th>Hits</th>
            </tr>
          </thead>
          <c:forEach var="board" items="${ requestScope.list }">
          <tbody>
            <tr>
              <td>${ board.boardId }</td>
              <td>${ board.boardUserId }</td>
              <td>
              	<c:if test="${ board.fileExist=='1' }">
             	  <span class="glyphicon glyphicon-picture"></span>
             	</c:if>
             	<c:if test="${ board.fileExist=='0' }">
             	  <span class="glyphicon glyphicon-comment"></span>
             	</c:if>
              </td>
              <td><a href="/OffTheRecord/getOneBoardById.action?boardId=${ board.boardId }">${ board.boardTitle }</a></td>
              <td>${ board.boardWriteDate }</td>
              <td>${ board.boardHits }</td>
            </tr>
          </tbody>
          </c:forEach>
          </tbody>
        </table>
      </div><!-- /.table-responsive -->
	<hr color="lightgray;">
	<p>
	<hr color="lightgray;">
	
	<c:if test="${ sessionScope.adminVo!=null }">
	<div style="float: right;">
	<button class="btn btn-default" onclick="javascript:location.href='admin/notice_write.jsp'">글 작성</button>
	</div>
	</c:if>
	<div style="float: right;">
		<select id="searching">
			<option value="searchingTitle">제목</option>
			<option value="searchingContent">내용</option>
			<option value="searchingId">글쓴이(ID)</option>
		</select>
		<input type="text" id="search" placeholder="게시물을 검색하시려면 여기에서 검색하세요.">
		<button class="btn btn-default btn-sm" id="searchBtn">검색</button>
		<c:if test="${ sessionScope.userVo!=null }">
			<button class="btn btn-default btn-sm" onclick="javascript:location.href='/OffTheRecord/board/board_write.jsp'">글 작성</button>
		</c:if>
	</div>
    </div>
</div>
<!--  -->
<div class="col-sm-2 col-md-2- col-lg-2"></div>

</div><!-- row -->
</div><!-- container -->

	<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
</body>
</html>